package com.gxa.modules.community.service.impl;

import com.gxa.modules.community.entity.ParkingType;
import com.gxa.modules.community.entity.Person;
import com.gxa.modules.community.entity.SpaceE;
import com.gxa.modules.community.entity.ParkingSpace;
import com.gxa.modules.community.mapper.ParkingSpaceMapper;
import com.gxa.modules.community.service.ParkingSpaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ParkingSpaceServiceImpl implements ParkingSpaceService {
    @Autowired
    private ParkingSpaceMapper parkingSpaceMapper;
    @Override
    public List<ParkingSpace> queryByPage(Map<String, Object> params) {
        String carstateId = (String)params.get("carstateId");
        String carparkingId = (String)params.get("carparkingId");
        String serialNo = (String)params.get("serialNo");
        String communityId = (String)params.get("communityId");
        List<ParkingSpace> parkingSpaces=this.parkingSpaceMapper.queryByPage(carstateId,carparkingId,serialNo,communityId);
        return parkingSpaces;
    }

    @Override
    public void parkingSpaceAdd(SpaceE parkingSpace) {
        this.parkingSpaceMapper.parkingSpaceAdd(parkingSpace);
    }

    @Override
    public void parkingSpaceUpdate(SpaceE parkingSpace) {
        this.parkingSpaceMapper.parkingSpaceUpdate(parkingSpace);
    }

    @Override
    public void parkingSpaceDelete(Integer id) {
        this.parkingSpaceMapper.parkingSpaceDelete(id);
    }

    @Override
    public List<Person> queryPerson(Map<String, Object> params) {
        String userId = (String)params.get("userId");
        System.out.println(userId);
        List<Person> personList=this.parkingSpaceMapper.queryPerson(userId);
        return personList;
    }

    @Override
    public List<ParkingType> queryParkingType() {
        List<ParkingType> parkingTypes=this.parkingSpaceMapper.queryParkingType();
        return parkingTypes;
    }

    @Override
    public void regionDeleteIds(List<Integer> ids) {
        this.parkingSpaceMapper.regionDeleteIds(ids);
    }
}
